# coding:utf-8
from django.apps import AppConfig
import os

VERBOSE_APP_NAME = u"论坛管理"


def get_current_app_name(_file):
    """
    获取app的名称
    :param _file:
    :return:
    """
    return os.path.split(os.path.dirname(_file))[-1]


class ForumConfig(AppConfig):
    name = get_current_app_name(__file__)
    verbose_name = VERBOSE_APP_NAME

    def ready(self):
        from replies.moderation import moderator
        from replies.moderation import ReplyModerator
        from replies.models import Reply
        from users.models import User
        from actstream import registry
        moderator.register(self.get_model('Post'), ReplyModerator)
        registry.register(self.get_model('Post'))
        registry.register(Reply)
        registry.register(User)
